#include <stdio.h>
//用第一个元素将待排序序列划分成左右两个部分
int partition(int A[],int low,int high){
    int pivot=A[low];   //第一个元素作为枢轴
    while (low<high)
    {
        while (low<high&&A[high]>=pivot)
            --high;
        A[low]=A[high];         //比较枢轴小的移到左边
        while (low<high&&A[low]<=pivot)
            ++low;
        A[high]=A[low];         //比较枢轴大的移到右边
    }
    A[low]=pivot;               //枢轴元素存放到最终位置
    return low;
}
void QuickSort(int A[],int low,int high){
    if (low<high){
    int partion=partition(A,low,high);
    QuickSort(A,partion+1,high);
    QuickSort(A,low,partion-1);
    }
}
int main()
{
    int A[10]={1,3,4,3,2,7,8,94,2};
    QuickSort(A,0,9);
    for (int i=0;i<10;i++){
        printf("%d ",A[i]);
    }
}